#pragma once
#ifndef COMMAND_H
#define COMMAND_H

#include <string>
#include <vector>
#include "Database.h"

class Command {
public:
    Command(Database& db);

    void executeCommand(const std::string& command);

    std::string readMultilineCommand();

private:
    Database& m_db;

    bool parseCreateDatabaseCommand(const std::string& command);
    bool parseDropDatabaseCommand(const std::string& command);
    bool parseUseDatabaseCommand(const std::string& command);
    bool parseCreateTableCommand(const std::string& command);
    bool parseDropTableCommand(const std::string& command);
    bool parseInsertCommand(const std::string& command);
    bool parseSelectCommand(const std::string& command);
    bool parseUpdateCommand(const std::string& command);
    bool parseDeleteCommand(const std::string& command);
    bool parseAlterTableCommand(const std::string& command);

    std::vector<std::string> splitCommand(const std::string& command);
    std::vector<std::string> splitColumnDefinitions(const std::string& columnDefinitions);
    std::vector<std::string> splitConditions(const std::string& conditions);
    std::vector<std::string> splitSetClause(const std::string& setClause);
    std::vector<std::string> splitRows(const std::string& rowsStr);
    std::string trim(const std::string& str);
};

void printValues(const std::vector<std::vector<Value>>& values);

#endif